$(function () {
  $('.collect').click(function () {
    if ($('.glyphicon').is('.glyphicon-heart-empty')) {
      $(this).children("span.col-text").text("已收藏");
      $(this).children("span.glyphicon").removeClass("green glyphicon-heart-empty");
      $(this).children("span.glyphicon").addClass("red glyphicon-heart");

    } else {
      $(this).children("span.col-text").text("收藏");
      $(this).children("span.glyphicon").removeClass("red glyphicon-heart");
      $(this).children("span.glyphicon").addClass("green glyphicon-heart-empty");
    }
  });

  //弹出一个页面层
  $('#price-info').on('click', function () {
    layer.open({

      type: 1,
      title: ['《价格说明》', 'font-size:18px;'],
      skin: 'layui-layer-molv',
      anim: 5,
      area: ['600px', '360px'],
      shadeClose: true, //点击遮罩关闭
      content: '\<\div style="padding:20px;">asasasa\<\/div>'
    });
  });

  layui.use('rate', function () {
    var rate = layui.rate;

    //渲染
    var ins1 =
      rate.render({
        elem: '#test2',
        value: 2.5 //初始值
          ,
        theme: '#00a680',
        text: true //开启文本
          ,
        half: true
      });
  })

  layui.use('rate', function () {
    var rate = layui.rate;

    //渲染
    var ins1 =
      rate.render({
        elem: '#test3',
        value: 2.5 //初始值
          ,
        theme: '#00a680',
        half: true
      });
  })
});

window.onload = function () {
  var map = map = new AMap.Map('wrapper-map', {
    zoom: 16, //设置地图显示的缩放级别
    center: [120.712113, 31.318868]
  });

  var marker = new AMap.Marker({
    position: new AMap.LngLat(120.712113, 31.318868), // 经纬度对象，也可以是经纬度构成的一维数组[120.712113, 31.318868]
    title: "同得兴"
  });

  map.add(marker);
};

$(function () { //显示三行 多余隐藏 点击展开
  $('.info-more').click(function () {
      if ($('.boxp').is('.box')) {
          $('.boxp').removeClass('box');
          $(this).children("span.more-text").text("收起全文");
          $(this).children("span.glyphicon-chevron-down").removeClass("glyphicon-chevron-down");
          $(this).children("span.glyphicon").addClass("glyphicon-chevron-up")

      } else {
          $(this).children("span.more-text").text("阅读更多");
          $(this).children("span.glyphicon-chevron-up").removeClass("glyphicon-chevron-up");
          $(this).children("span.glyphicon").addClass("glyphicon-chevron-down")
          $('.boxp').addClass('box');
      }
      $('.more-details').toggle();
      $('.more-detail').toggle();

  });

  $(".item").mouseover(function (){
      $(this).addClass("cc");
  }).mouseout(function (){
     
      $(this).removeClass("cc");
  });
});